import request from '@/common/vmeitime-http';

/**
 * @desc 获取楼盘详情
 * @params productId {String} 楼盘ID
 * @param puid {String} 用户id
 * @param {String} version 用于加密通道的version
 */
export function productDetailAPI(info){
    return request.request({
        url: `/product/mall/v6/${info.productId}?puid=${info.puid}`
    })
}

/**
 * @desc 获取楼盘周边配套
 */
export function productNearbyAPI(url){
    return request.request({
        url
    })
}

/**
 * @desc 获取楼盘噪音图片列表
 * @params kaiId {String} 开盘ID
 */
export function noiseImagesAPI(kaiId){
    return request.request({
        url: `/product/mall/v6/pan/noise/${kaiId}`
    })
}

/**
 * @desc 获取楼盘栋距图片列表
 * @params kaiId {String} 开盘ID
 */
export function spacingImagesAPI(kaiId){
    return request.request({
        url: `/product/mall/v6/pan/distance/${kaiId}`
    })
}

/**
 * @desc 获取楼盘户型分布图片列表
 * @params kaiId {String} 开盘ID
 */
export function distributionImagesAPI(kaiId){
    return request.request({
        url: `/product/mall/v6/pan/housetype/${kaiId}`
    })
}

/**
 * @desc 获取楼盘户型测评列表
 * @params kaiId {String} 开盘ID
 */
export function houseEvaluationList(kaiId){
    return request.request({
        url: `/product/mall/v6/pan/size/evaluate/${kaiId}`
    })
}

/**
 * @desc 获取楼盘不利因素列表
 * @params kaiId {String} 开盘ID
 */
export function disadvantageList(kaiId){
    return request.request({
        url: `/product/mall/v6/pan/bad/${kaiId}`
    })
}


/**
 * @desc 获取户型评测详情
 * @param kaiId {String} 开盘id
 */
export function houseEvaluationDetail(kaiId){
    return request.request({
        url: `/product/mall/v6/pan/size/evaluate/dlist/${kaiId}`
    })
}

/**
 * @desc 获取楼盘公共信息 title,image,channelId,subscribe
 * @param id {String} 楼盘id
 */
export function productInfoAPI(id){
    return request.request({
        url: `/product/mall/v6/common/${id}`
    })
}

/**
 * @desc 删除楼盘内自己的评论或回复
 * @param id {Number} 评论/回复id
 */
export function deleteCommentAPI(id){
    return request.request({
        url: `/product/mall/cm/api/detail/${id}`,
        method: 'delete'
    })
}

/**
 * @desc 认购分数填报获取
 * @param kaiId {Number} 开盘ID
 * @param socre {Number} 分数
 * @param method {String} get post
 */
export function renGouScoreAPI({kaiId, method='get', data=''}){
    return request.request({
        url: `/product/assist/mall/score/${kaiId}`,
        method,
        data
    })
}

/**
 * 收藏户型评测
 * @param id {Number} 评测ID
 * @param action {Number} 1
 * 
 */
export function collectHouseType(data){
    return request.request({
        url: `/product/mall/v6/evaluate/action/${data.id}`,
        method: 'post',
        data
    })
}

/**
 * 获取开盘内楼层平面图
 * @param kaiId {Number} 开盘ID
 * 
 */
export function floorPlanList(kaiId){
    return request.request({
        url: `/product/mall/v6/pan/floor/${kaiId}`,
    })
}

/**
 * 根据楼盘ID获取有数据的楼盘相册
 * @param productId {Number}
*/
export function hasAlbumPanList(productId){
    return request.request({
        url: `/product/mall/v6/pan/image/list/${productId}`
    })
}

/**
 * 根据楼盘ID获取所有开盘内的一房一价栋列均价表数据
 * @param productId {Number}
*/
export function buildingColumnAverageById(productId){
    return request.request({
        url: `/product/mall/smart/stat/data/${productId}`
    })
}

/**
 * 报名通道楼盘信息和背景图获取
 * @param {productId} Number 楼盘ID
*/
export function signHouseDetailGet(productId){
    return request.request({
        url: `/product/ads/mall/business/${productId}`
    })
}

/**
 * 报名通道提交手机号
 * @param {id} Number 楼盘ID
 * @param {phone} 手机号
*/
export function signHousePost(data){
    return request.request({
        url: `/product/ads/mall/business/${data.id}`,
        method: 'post',
        data
    })
}
/**
 * 获取开盘内的业主二维码
 * @param {kaiId} Number 开盘ID
*/
export function getDelegQrcode(kaiId){
    return request.request({
        url: `/product/mall/group/info/${kaiId}`
    })
}

/**
 * 提交业主群二维码申请
 * @param {Object} product:楼盘id、pan:开盘id、name:姓名、image_list:二维码、avatar_list:头像
*/
export function createLandForm(data){
    return request.request({
        url: `/product/mall/group/create`,
        method: 'post',
        data
    })
}

/**
 * 修改业主群二维码申请
 * @param {Object} product:楼盘id、pan:开盘id、name:姓名、image_list:二维码、avatar_list:头像
*/
export function updateLandForm(data){
    return request.request({
        url: `/product/mall/group/update`,
        method: 'put',
        data
    })
}

/**
 * 请求二维码申请状态
 * 
*/
export function getLandQrStatus(){
    return request.request({
        url: `/product/mall/group/status`
    })
}